package com.hsq.end_of_period;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class LoginFrame extends JFrame {
    private JButton okButton;
    JTextArea txt;
    public LoginFrame() {
        setTitle("Login");
        setSize(300, 200);
        setLayout(new FlowLayout());
        okButton = new JButton("OK");
        txt = new JTextArea();
        txt.setBounds(60, 10, 100, 20);
        okButton.setBounds(60, 20, 80, 30);
        okButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
//                JOptionPane.showMessageDialog(LoginFrame.this, "欢迎参加Java考试");
                txt.setText("欢迎参加Java考试");
            }
        });
        this.add(okButton);
        this.add(txt);
        this.setLocationRelativeTo(null);
        this.setVisible(true);
        this.setDefaultCloseOperation(EXIT_ON_CLOSE);
    }
    public static void main(String[] args) {
        new LoginFrame();
    }
}
